package com.tudouji.project.wlinfo.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.wlinfo.domain.Wlinfoitem;
import com.tudouji.project.wlinfo.service.IWlinfoitemService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 物流明细Controller
 * 
 * @author tudouji
 * @date 2021-04-29
 */
@RestController
@RequestMapping("/wlinfo/wlinfoitem")
public class WlinfoitemController extends BaseController
{
    @Autowired
    private IWlinfoitemService wlinfoitemService;

    /**
     * 查询物流明细列表
     */
    @PreAuthorize("@ss.hasPermi('wlinfo:wlinfoitem:list')")
    @GetMapping("/list")
    public TableDataInfo list(Wlinfoitem wlinfoitem)
    {
        startPage();
        List<Wlinfoitem> list = wlinfoitemService.selectWlinfoitemList(wlinfoitem);
        return getDataTable(list);
    }

    /**
     * 导出物流明细列表
     */
    @PreAuthorize("@ss.hasPermi('wlinfo:wlinfoitem:export')")
    @Log(title = "物流明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Wlinfoitem wlinfoitem)
    {
        List<Wlinfoitem> list = wlinfoitemService.selectWlinfoitemList(wlinfoitem);
        ExcelUtil<Wlinfoitem> util = new ExcelUtil<Wlinfoitem>(Wlinfoitem.class);
        return util.exportExcel(list, "wlinfoitem");
    }

    /**
     * 获取物流明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('wlinfo:wlinfoitem:query')")
    @GetMapping(value = "/{guid}")
    public AjaxResult getInfo(@PathVariable("guid") String guid)
    {
        return AjaxResult.success(wlinfoitemService.selectWlinfoitemById(guid));
    }

    /**
     * 新增物流明细
     */
    @PreAuthorize("@ss.hasPermi('wlinfo:wlinfoitem:add')")
    @Log(title = "物流明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Wlinfoitem wlinfoitem)
    {
        return toAjax(wlinfoitemService.insertWlinfoitem(wlinfoitem));
    }

    /**
     * 修改物流明细
     */
    @PreAuthorize("@ss.hasPermi('wlinfo:wlinfoitem:edit')")
    @Log(title = "物流明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Wlinfoitem wlinfoitem)
    {
        return toAjax(wlinfoitemService.updateWlinfoitem(wlinfoitem));
    }

    /**
     * 删除物流明细
     */
    @PreAuthorize("@ss.hasPermi('wlinfo:wlinfoitem:remove')")
    @Log(title = "物流明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids)
    {
        return toAjax(wlinfoitemService.deleteWlinfoitemByIds(guids));
    }
}
